﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SoftwareEngineering_Project.Accounts
{
    public partial class ConfirmRegistration : System.Web.UI.Page
    {
        private SoftwareEngineering_Project.User CurrentUser
        {
            get
            {
                return (SoftwareEngineering_Project.User)Session["CurrentUser"];
            }
            set
            {
                Session["CurrentUser"] = value;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            User user = new User();
            if (user.ChangeStatus(Username.Text,Password.Text,AccessCode.Text))
            {
                Errormessage.Visible = true;
                Errormessage.Text = "your account is succefully registered";
                user.getUser(Username.Text);
                CurrentUser = user;
                Response.Redirect("~/Default.aspx");
            }
            else
            {
                Errormessage.Visible = true;
                Errormessage.Text = "UserName, Password or acces code is not valid. Please check your email again and verify your information!";
            }


        }
    }
}